//
//  NSString+Extend.m
//  CFFinanceProject
//
//  Created by chunfeng on 2018/4/9.
//  Copyright © 2018年 xiaowen. All rights reserved.
//

#import "NSString+Extend.h"

@implementation NSString (Extend)


+ (BOOL)stringIsNullOrEmpty:(NSString *)str
{
    return (str == nil || [str isKindOfClass:[NSNull class]] || str.length == 0);
}

- (BOOL)isNull{
    return (self == nil || [self isKindOfClass:[NSNull class]]);
}

- (BOOL)isNullOrEmpty{
    return (self == nil || [self isKindOfClass:[NSNull class]] || self.length == 0);
    
}

+(NSString *)getStringIsNotNull:(NSString *)str{
    if(str == nil || [str isKindOfClass:[NSNull class]] || str.length == 0){
        return @"";
    }else{
        return str;
    }
}
- (NSString *)removeNullOrEmptyByDefaultString:(NSString *)defaultString{
    BOOL isEmpty = [[self class] stringIsNullOrEmpty:self];
    if (isEmpty) {
        return defaultString;
    }else{
        return self;
    }
}


@end
